﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;

namespace NAccounting
{
    public static class CurrentDecimalExtensions
    {
        private static CultureInfo _culture = System.Threading.Thread.CurrentThread.CurrentUICulture;

        public static string ToCurrencyString(this decimal? source)
        { 
            return String.Format("{0} {1}", _culture.NumberFormat.CurrencySymbol, source.HasValue ? source.Value.ToString("N") : "0,00");
        }

        public static string ToCurrencyString(this decimal source)
        {
            return String.Format("{0} {1}", _culture.NumberFormat.CurrencySymbol, source.ToString("N"));
        }
    }
}